(in-package :TRAPS)
; Generated from #P"macintosh-hd:hd3:CInterface Translator:Source Interfaces:CFXMLParser.h"
; at Sunday July 2,2006 7:22:55 pm.
; 	CFXMLParser.h
; 	Copyright (c) 1998-2003, Apple, Inc. All rights reserved.
; 

; #if !defined(__COREFOUNDATION_CFXMLPARSER__)
(defconstant $__COREFOUNDATION_CFXMLPARSER__ 1)
; #define __COREFOUNDATION_CFXMLPARSER__ 1

(require-interface "CoreFoundation/CFBase")

(require-interface "CoreFoundation/CFArray")

(require-interface "CoreFoundation/CFData")

(require-interface "CoreFoundation/CFDictionary")

(require-interface "CoreFoundation/CFTree")

(require-interface "CoreFoundation/CFURL")

(require-interface "CoreFoundation/CFXMLNode")

; #if defined(__cplusplus)
#|
extern "C" {
#endif
|#

(def-mactype :CFXMLParserRef (find-mactype '(:pointer :__CFXMLParser)))
;  These are the various options you can configure the parser with.  These are
;    chosen such that an option flag of 0 (kCFXMLParserNoOptions) leaves the XML
;    as "intact" as possible (reports all structures; performs no replacements).
;    Hence, to make the parser do the most work, returning only the pure element
;    tree, set the option flag to kCFXMLParserAllOptions.
; 
; kCFXMLParserValidateDocument -
;    validate the document against its grammar from the DTD, reporting any errors.
;    Currently not supported.
; 
; kCFXMLParserSkipMetaData -
;    silently skip over metadata constructs (the DTD and comments)
; 
; kCFXMLParserReplacePhysicalEntities -
;    replace declared entities like &lt;.  Note that other than the 5 predefined
;    entities (lt, gt, quot, amp, apos), these must be defined in the DTD.
;    Currently not supported.
; 
; kCFXMLParserSkipWhitespace -
;    skip over all whitespace that does not abut non-whitespace character data.
;    In other words, given <foo>  <bar> blah </bar></foo>, the whitespace between
;    foo's open tag and bar's open tag would be suppressed, but the whitespace
;    around blah would be preserved.
; 
; kCFXMLParserAddImpliedAttributes -
;    where the DTD specifies implied attribute-value pairs for a particular element,
;    add those pairs to any occurances of the element in the element tree.
;    Currently not supported.
; 

(defconstant $kCFXMLParserValidateDocument 1)
(defconstant $kCFXMLParserSkipMetaData 2)
(defconstant $kCFXMLParserReplacePhysicalEntities 4)
(defconstant $kCFXMLParserSkipWhitespace 8)
(defconstant $kCFXMLParserResolveExternalEntities 16)
(defconstant $kCFXMLParserAddImpliedAttributes 32)
(defconstant $kCFXMLParserAllOptions #xFFFFFF)
(defconstant $kCFXMLParserNoOptions 0)
(def-mactype :CFXMLParserOptions (find-mactype ':SINT32))
;  This list is expected to grow 

(defconstant $kCFXMLStatusParseNotBegun -2)
(defconstant $kCFXMLStatusParseInProgress -1)
(defconstant $kCFXMLStatusParseSuccessful 0)
(defconstant $kCFXMLErrorUnexpectedEOF 1)
(defconstant $kCFXMLErrorUnknownEncoding 2)
(defconstant $kCFXMLErrorEncodingConversionFailure 3)
(defconstant $kCFXMLErrorMalformedProcessingInstruction 4)
(defconstant $kCFXMLErrorMalformedDTD 5)
(defconstant $kCFXMLErrorMalformedName 6)
(defconstant $kCFXMLErrorMalformedCDSect 7)
(defconstant $kCFXMLErrorMalformedCloseTag 8)
(defconstant $kCFXMLErrorMalformedStartTag 9)
(defconstant $kCFXMLErrorMalformedDocument 10)
(defconstant $kCFXMLErrorElementlessDocument 11)
(defconstant $kCFXMLErrorMalformedComment 12)
(defconstant $kCFXMLErrorMalformedCharacterReference 13)
(defconstant $kCFXMLErrorMalformedParsedCharacterData 14)
(defconstant $kCFXMLErrorNoData 15)
(def-mactype :CFXMLParserStatusCode (find-mactype ':SINT32))
;   These functions are called as a parse progresses.
; 
; createXMLStructure -
;   called as new XML structures are encountered by the parser.  May return NULL to indicate
;   that the given structure should be skipped; if NULL is returned for a given structure,
;   only minimal parsing is done for that structure (enough to correctly determine its end,
;   and to extract any data necessary for the remainder of the parse, such as Entity definitions).
;   createXMLStructure (or indeed, any of the tree-creation callbacks) will not be called for any
;   children of the skipped structure.  The only exception is that the top-most element will always
;   be reported even if NULL was returned for the document as a whole.  NOTE: for performance reasons,
;   the node passed to createXMLStructure cannot be safely retained by the client; the node as
;   a whole must be copied (via CFXMLNodeCreateCopy), or its contents must be extracted and copied.
; 
; addChild -
;   called as children are parsed and are ready to be added to the tree.  If createXMLStructure
;   returns NULL for a given structure, that structure is omitted entirely, and addChild will
;   NOT be called for either a NULL child or parent.
; 
; endXMLStructure -
;   called once a structure (and all its children) are completely parsed.  As elements are encountered,
;   createXMLStructure is called for them first, then addChild to add the new structure to its parent,
;   then addChild (potentially several times) to add the new structure's children to it, then finally 
;   endXMLStructure to show that the structure has been fully parsed.
; 
; createXMLStructure, addChild, and endXMLStructure are all REQUIRED TO BE NON-NULL.
; 
; resolveExternalEntity -
;   called when external entities are referenced (NOT when they are simply defined).  If the function
;   pointer is NULL, the parser uses its internal routines to try and resolve the entity.  If the
;   function pointer is set, and the function returns NULL, a place holder for the external entity
;   is inserted into the tree.  In this manner, the parser's client can prevent any external network 
;   or file accesses.
; 
; handleError - called as errors/warnings are encountered in the data stream.  At some point, we will
;   have an enum of the expected errors, some of which will be fatal, others of which will not.  If
;   the function pointer is NULL, the parser will silently attempt to recover.  The
;   handleError function may always return false to force the parser to stop; if handleError returns
;   true, the parser will attempt to recover (fatal errors will still cause the parse to abort
;   immediately).
; 

(def-mactype :CFXMLParserCreateXMLStructureCallBack (find-mactype ':pointer)); (CFXMLParserRef parser , CFXMLNodeRef nodeDesc , void * info)

(def-mactype :CFXMLParserAddChildCallBack (find-mactype ':pointer)); (CFXMLParserRef parser , void * parent , void * child , void * info)

(def-mactype :CFXMLParserEndXMLStructureCallBack (find-mactype ':pointer)); (CFXMLParserRef parser , void * xmlType , void * info)

(def-mactype :CFXMLParserResolveExternalEntityCallBack (find-mactype ':pointer)); (CFXMLParserRef parser , CFXMLExternalID * extID , void * info)

(def-mactype :CFXMLParserHandleErrorCallBack (find-mactype ':pointer)); (CFXMLParserRef parser , CFXMLParserStatusCode error , void * info)
(defrecord CFXMLParserCallBacks
   (version :SInt32)
   (createXMLStructure :pointer)
   (addChild :pointer)
   (endXMLStructure :pointer)
   (resolveExternalEntity :pointer)
   (handleError :pointer)
)

(def-mactype :CFXMLParserRetainCallBack (find-mactype ':pointer)); (const void * info)

(def-mactype :CFXMLParserReleaseCallBack (find-mactype ':pointer)); (const void * info)

(def-mactype :CFXMLParserCopyDescriptionCallBack (find-mactype ':pointer)); (const void * info)
(defrecord CFXMLParserContext
   (version :SInt32)
   (info :pointer)
   (retain :pointer)
   (release :pointer)
   (copyDescription :pointer)
)

(deftrap-inline "_CFXMLParserGetTypeID" 
   (
   )
   :UInt32
() )
;  Creates a parser which will parse the given data with the given options.  xmlData may not be NULL. 
;    dataSource should be the URL from which the data came, and may be NULL; it is used to resolve any
;    relative references found in xmlData. versionOfNodes determines which version CFXMLNodes are produced
;    by the parser; see CFXMLNode.h for more details.  callBacks are the callbacks called by the parser as
;    the parse progresses; callBacks, callBacks->createXMLStructure, callBacks->addChild, and
;    callBacks->endXMLStructure must all be non-NULL.  context determines what if any info pointer is
;    passed to the callbacks as the parse progresses; context may be NULL.  

(deftrap-inline "_CFXMLParserCreate" 
   ((allocator (:pointer :__CFAllocator))
    (xmlData (:pointer :__CFData))
    (dataSource (:pointer :__CFURL))
    (parseOptions :UInt32)
    (versionOfNodes :SInt32)
    (callBacks (:pointer :CFXMLPARSERCALLBACKS))
    (context (:pointer :CFXMLPARSERCONTEXT))
   )
   (:pointer :__CFXMLParser)
() )

; #if !defined(DARWIN)
;  Arguments as above, except that the data to be parsed is loaded directly 
;    from dataSource.  dataSource may not be NULL.  

(deftrap-inline "_CFXMLParserCreateWithDataFromURL" 
   ((allocator (:pointer :__CFAllocator))
    (dataSource (:pointer :__CFURL))
    (parseOptions :UInt32)
    (versionOfNodes :SInt32)
    (callBacks (:pointer :CFXMLPARSERCALLBACKS))
    (context (:pointer :CFXMLPARSERCONTEXT))
   )
   (:pointer :__CFXMLParser)
() )

; #endif /* !DARWIN */


(deftrap-inline "_CFXMLParserGetContext" 
   ((parser (:pointer :__CFXMLParser))
    (context (:pointer :CFXMLPARSERCONTEXT))
   )
   nil
() )

(deftrap-inline "_CFXMLParserGetCallBacks" 
   ((parser (:pointer :__CFXMLParser))
    (callBacks (:pointer :CFXMLPARSERCALLBACKS))
   )
   nil
() )

(deftrap-inline "_CFXMLParserGetSourceURL" 
   ((parser (:pointer :__CFXMLParser))
   )
   (:pointer :__CFURL)
() )
;  Returns the character index of the current parse location 

(deftrap-inline "_CFXMLParserGetLocation" 
   ((parser (:pointer :__CFXMLParser))
   )
   :SInt32
() )
;  Returns the line number of the current parse location 

(deftrap-inline "_CFXMLParserGetLineNumber" 
   ((parser (:pointer :__CFXMLParser))
   )
   :SInt32
() )
;  Returns the top-most object returned by the createXMLStructure callback 

(deftrap-inline "_CFXMLParserGetDocument" 
   ((parser (:pointer :__CFXMLParser))
   )
   (:pointer :void)
() )
;  Get the status code or a user-readable description of the last error that occurred in a parse.
;    If no error has occurred, a null description string is returned.  See the enum above for
;    possible status returns 

(deftrap-inline "_CFXMLParserGetStatusCode" 
   ((parser (:pointer :__CFXMLParser))
   )
   :SInt32
() )

(deftrap-inline "_CFXMLParserCopyErrorDescription" 
   ((parser (:pointer :__CFXMLParser))
   )
   (:pointer :__CFString)
() )
;  Cause any in-progress parse to abort with the given error code and description.  errorCode
;    must be positive, and errorDescription may not be NULL.  Cannot be called asynchronously
;    (i.e. must be called from within a parser callback) 

(deftrap-inline "_CFXMLParserAbort" 
   ((parser (:pointer :__CFXMLParser))
    (errorCode :SInt32)
    (errorDescription (:pointer :__CFString))
   )
   nil
() )
;  Starts a parse of the data the parser was created with; returns success or failure.
;    Upon success, use CFXMLParserGetDocument() to get the product of the parse.  Upon
;    failure, use CFXMLParserGetErrorCode() or CFXMLParserCopyErrorDescription() to get
;    information about the error.  It is an error to call CFXMLParserParse() while a
;    parse is already underway. 

(deftrap-inline "_CFXMLParserParse" 
   ((parser (:pointer :__CFXMLParser))
   )
   :Boolean
() )
;  These functions provide a higher-level interface.  The XML data is parsed to a
;    special CFTree (an CFXMLTree) with known contexts and callbacks.  See CFXMLNode.h
;    for full details on using an CFXMLTree and the CFXMLNodes contained therein.
; 
;  Parse to an CFXMLTreeRef.  parseOptions are as above. versionOfNodes determines
;    what version CFXMLNodes are used to populate the tree.  

(deftrap-inline "_CFXMLTreeCreateFromData" 
   ((allocator (:pointer :__CFAllocator))
    (xmlData (:pointer :__CFData))
    (dataSource (:pointer :__CFURL))
    (parseOptions :UInt32)
    (versionOfNodes :SInt32)
   )
   (:pointer :__CFTree)
() )
;  As above, with the additional by-reference pass of a CFDictionaryRef containing
;    various error information (see below). The caller is responsible for releasing the
;    returned dictionary. If the error dictionary is not desired, pass NULL. 

(deftrap-inline "_CFXMLTreeCreateFromDataWithError" 
   ((allocator (:pointer :__CFAllocator))
    (xmlData (:pointer :__CFData))
    (dataSource (:pointer :__CFURL))
    (parseOptions :UInt32)
    (versionOfNodes :SInt32)
    (errorDict (:pointer :CFDICTIONARYREF))
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   (:pointer :__CFTree)
() )

; #if !defined(DARWIN)
;  Loads the data to be parsed directly from dataSource.  Arguments as above. 

(deftrap-inline "_CFXMLTreeCreateWithDataFromURL" 
   ((allocator (:pointer :__CFAllocator))
    (dataSource (:pointer :__CFURL))
    (parseOptions :UInt32)
    (versionOfNodes :SInt32)
   )
   (:pointer :__CFTree)
() )

; #endif /* !DARWIN */

;  Generate the XMLData (ready to be written to whatever permanent storage is to be
;    used) from an CFXMLTree.  Will NOT regenerate entity references (except those
;    required for syntactic correctness) if they were replaced at the parse time;
;    clients that wish this should walk the tree and re-insert any entity references
;    that should appear in the final output file. 

(deftrap-inline "_CFXMLTreeCreateXMLData" 
   ((allocator (:pointer :__CFAllocator))
    (xmlTree (:pointer :__CFTree))
   )
   (:pointer :__CFData)
() )
;  Escaping and unescaping XML entities in CFStrings. The standard XML entities
;    are always replaced.  
;  Creates a CFString by replacing entities that appear in the entities dictionary.
;    Dictionary keys are the entities themselves, and the values should be CFStrings
;    containing the expansion. Pass NULL for entitiesDictionary to indicate no entities
;    other than the standard five. 

(deftrap-inline "_CFXMLCreateStringByEscapingEntities" 
   ((allocator (:pointer :__CFAllocator))
    (string (:pointer :__CFString))
    (entitiesDictionary (:pointer :__CFDictionary))
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   (:pointer :__CFString)
() )

(deftrap-inline "_CFXMLCreateStringByUnescapingEntities" 
   ((allocator (:pointer :__CFAllocator))
    (string (:pointer :__CFString))
    (entitiesDictionary (:pointer :__CFDictionary))
   )                                            ; AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
   (:pointer :__CFString)
() )
;  CFXMLTreeCreateFromDataWithError error dictionary key constants. 
(def-mactype :kCFXMLTreeErrorDescription (find-mactype ':CFStringRef)); AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
;  value is a CFString containing the readable error string. 
(def-mactype :kCFXMLTreeErrorLineNumber (find-mactype ':CFStringRef)); AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
;  value is a CFNumber containing the line on which the error appears. 
(def-mactype :kCFXMLTreeErrorLocation (find-mactype ':CFStringRef)); AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
;  value is a CFNumber containing the byte location at which the error occurred. 
(def-mactype :kCFXMLTreeErrorStatusCode (find-mactype ':CFStringRef)); AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
;  value is a CFNumber containing the error status code. 

; #if defined(__cplusplus)
#|
}
#endif
|#

; #endif /* ! __COREFOUNDATION_CFXMLPARSER__ */


(provide-interface "CFXMLParser")